package com.asiainfo.utils;

import com.asiainfo.conf.Constants;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ConfigurationUtil {

    final static private Logger logger = LoggerFactory.getLogger(ConfigurationUtil.class);

    protected static final Properties param = new Properties();

    static {
        InputStream in =
            ConfigurationUtil.class.getClassLoader()
                .getResourceAsStream(Constants.CONFIG_PROPERTIES_FILE);
        try {
            param.load(in);
        } catch (IOException e) {
            logger.error("加载配置文件失败:", e);
            System.exit(-1);
        }
    }

    public static String getPrivateKeyPath() {
        return param.getProperty(Constants.PRIVATE_KEY_PATH, null);
    }

    public static String getPublicKeyPath() {
        return param.getProperty(Constants.PUBLIC_KEY_PATH, null);
    }

    public static String getToken() {
        return param.getProperty(Constants.TOKEN, null);
    }

    public static String getAuthorizeCheckURL() {
        return param.getProperty(Constants.AUTHORIZECHECK_URL, null);
    }

    public static String getAuthenticationCheckURL() {
        return param.getProperty(Constants.AUTHENTICATIONCHECK_URL, null);
    }


}
